
<template>
	<el-dialog :visible.sync="addBottleShow"
		 @close="$emit('update:showAddBottle',false)"
		 width="30%" 
		 :show-close='false' 
		 :append-to-body='true'>
 
    	<span slot="title" class="dialog-title">
		  	设置采样要求
			<el-button  size="mini" class="popupClose" @click="resetAddBottleForm">关闭</el-button>
			  </span>
			  
			     <el-form label-width="110px" :inline="false" class="demo-form-inline" :model="addBottleForm" :rules="addBottleRules" ref="sampleForm">
		
          <el-form-item label="采样人">
            <el-col :span="22">
            <!--<el-select v-model="addBottleForm.collectionMan" multiple placeholder="请选择" >
                        <el-option
                          v-for="item in caiyangrenData"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value">
                        </el-option>
                    </el-select>-->
             
                    
                <el-select
              	filterable
              	v-model="addBottleForm.collectionMan" 
              	placeholder="请选择" 
              	
              	size = 'mini' >
						<el-option v-for="item in EmployeeByLabs" 
										:key="item.account" 
										:label="item.name" 
										:value="item.account" :disabled="item.disabled">
						</el-option>
				</el-select>
            </el-col>
          </el-form-item>
          
          <el-form-item label="现场负责人">
            <el-col :span="22">
            <el-select
              	filterable
              	v-model="addBottleForm.collectionLeader" 
              	placeholder="请选择" 
            
              	size = 'mini' >
						<el-option v-for="item in EmployeeByLabs" 
										:key="item.account" 
										:label="item.name" 
										:value="item.account" :disabled="item.disabled">
						</el-option>
				</el-select>
              <!--<el-select v-model="addBottleForm.collectionLeader" placeholder="请选择" >
                        <el-option
                          v-for="item in xianchangrenData"
                          :key="item.value"
                          :label="item.label"
                          :value="item.value">
                        </el-option>
                    </el-select>-->
            </el-col>
          </el-form-item>
         </el-form>
         
          <span slot="footer" class="dialog-footer" >
			    <el-button type="primary" @click="doEdit" size="mini">确 定</el-button>
			    <el-button  size="mini" @click="resetAddBottleForm">取 消</el-button>
			  </span>
  </el-dialog>
</template>

<script>

import { mapState } from 'vuex'

export default {
	props:['newOrEdit','canEdit','showAddBottle','selectedArr'],
  data () {
    return {
    	addBottleForm:{
    	collectionMan:'',
      	 collectionLeader:'',
    	},
      yesornoValue:'1',
      enableStatusValue:'1',
      caiyangData:[
                  {
                    rongqileixing:'',
                    pingshu:'',
                  }
      ],
     addBottleRules:{},
      popupPenalStyle:{
        // height:(window.innerHeight - 500)+'px',
        'min-height':'500px',
//      'top': '300px'
      },
      penalContentStyle:{
        'height':(window.innerHeight - 400)+'px'
      },
      rongqirongliang:[
                        {
                          value:'000',
                          label:'200ml'
                        },
                        {
                          value:'001',
                          label:'500ml'
                        },
                        {
                          value:'002',
                          label:'1000ml'
                        },
                        {
                          value:'003',
                          label:'2000ml'
                        }
      ]
    }
  },
  computed:{
    ...mapState(['enableStatus','tableHeightA','yesorno','enableStatus','bottleType','caiyangrenData','EmployeeByLabs']),
			addBottleShow:{
			    get: function () {
			    	
			      return this.showAddBottle
				},
			    set: function (newValue) {
	 
			    }
			}
		
  },
  mounted(){
  
  },
  methods:{
  		resetAddBottleForm(){
				this.$emit('update:showAddBottle',false)
			},
			getName(value){
					let filterArr=[];
							filterArr=this.EmployeeByLabs.filter(item => item.account===value)
							if(filterArr.length!=0){
								return filterArr[0].name
							}
			},
			doEdit(){
				
			
				for(let i of this.selectedArr){
					this.$set( i, 'collectionLeader', this.addBottleForm.collectionLeader )
					this.$set( i, 'collectionLeaderName', this.getName(this.addBottleForm.collectionLeader))
					this.$set( i, 'collectionMan', this.addBottleForm.collectionMan)
					this.$set( i, 'collectionManName', this.getName(this.addBottleForm.collectionMan))
				}
				
				this.addBottleForm={
		    		 collectionMan:'',
			      	 collectionLeader:''
			    	}
					
			this.$emit('update:showAddBottle',false)
			}
  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>

</style>
